package com.example.springboot_demo01.controller;

import com.example.springboot_demo01.entity.College;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

//学院信息控制器类--提供各种接口给外部进行访问
@RestController

@Api(tags = "学院信息接口")
public class CollegeController {

    //创建方法 并映射一个url供外部访问
    @GetMapping("/college")
    public String demo1(){
        return "hello,welcome to jju";
    }

    @ApiOperation("根据id获得某个学院信息")
    @GetMapping("/college/getById")
    public College getById(int id){
        return  new College();
    }

    @ApiOperation("获得所有学院信息")
    @GetMapping("/college/getAll")
    public List<College> getAll(){
        List<College> dataList = new ArrayList<>();
        dataList.add(new College());
        dataList.add(new College());

        return dataList;
    }

    @ApiOperation("增加学院信息")
    @PostMapping("/college/add")
    public int add(College obj){
        int ret = 0;

        return ret;
    }
}
